-- 显式类型转换
-- data:companyId:uid
local dataKey = KEYS[1]
--grid:companyId:
local gridKeyPrefix = KEYS[2]
local expireSec = tonumber(KEYS[3])

local value = ARGV[1] -- 二进制数据直接传递

redis.call('SET', dataKey, value)
if expireSec > 0 then
    redis.call('EXPIRE', dataKey, expireSec)
end
-- 处理坐标列表
for i = 4, #KEYS do
    local xy = KEYS[i]
    local setKey = gridKeyPrefix.. xy
    redis.call('SADD', setKey, dataKey)
end


return 1